package org.wsiz.vro.web.domain.enums;

import static com.google.common.collect.Lists.newArrayList;

import java.util.List;

import javax.faces.model.SelectItem;

import org.springframework.stereotype.Component;
import org.wsiz.vro.domain.enums.Civility;


/**
 * Helper to support the h:selectOneRadio and h:selectOneMenu for account.civility
 */
@Component
public class CivilityItems {

    /**
     * Returns a list of SelectItem/Civility ready to use in a h:selectOneRadio and h:selectOneMenu tags
     */
    public List<SelectItem> getList() {
        List<SelectItem> result = newArrayList();
        for (Civility civility : Civility.values()) {
            result.add(new SelectItem(civility, civility.getLabel()));
        }

        return result;
    }
}
